package com.bit.strongbaby;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class Myadapter extends BaseAdapter{
	Context maincon;
	LayoutInflater Inflater;
	ArrayList<Myitem> arSrc;
	int layout;
	
	public Myadapter(Context context, int alayout, ArrayList<Myitem> aarSrc){
		maincon = context;
		Inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		arSrc = aarSrc;
		layout= alayout;
	}
	
	public int getCount() {
		// TODO Auto-generated method stub
		return arSrc.size();
	}

	public Object getItem(int position) {
		return arSrc.get(position).Name;
	}

	public long getItemId(int position) {
		
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		final int pos = position;
		if(convertView == null){
			convertView = Inflater.inflate(layout, parent, false);
		}
		
		ImageView img = (ImageView)convertView.findViewById(R.id.img2);
		img.setImageResource(arSrc.get(position).Icon);

		return convertView;
		
	}



}
